home *** CD-ROM | disk | FTP | other *** search
- ; CI.ASM - No-wait keyboard input routine designed for use with
- ; Microsoft C programs. Function ci() returns -1 if there
- ; is no keyboard input ready; otherwise it returns the
- ; character read from the keyboard.
-
- SMALL EQU 0
- LARGE EQU 1
-
- CODE_M equ SMALL ; Set according to code model being used
-
- _TEXT segment para public 'CODE'
- assume cs:_TEXT
- public _ci
-
- if CODE_M
- _ci proc far
- else
- _ci proc near ; read character from keyboard
- endif
-
- mov ah,1
- int 16h
- jz nochar
- mov ah,0
- int 16h
- or al,al
- jz _ci1 ; if extended code
- xor ah,ah ; if not, zero high byte
- _ci1: ret
- nochar: mov ax,0ffffh
- ret
- _ci endp
-
- _TEXT ends
- end